﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace MachineVision.Domain.Migrations
{
    public partial class RobotSthing : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "MissionHistoryInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Name = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Type = table.Column<int>(type: "int", nullable: false),
                    Terminal = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Equipment = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ResultValue = table.Column<double>(type: "double", nullable: true),
                    StartTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    DetectionResult = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VisionMissionId = table.Column<int>(type: "int", nullable: false),
                    ArmCode = table.Column<int>(type: "int", nullable: true),
                    Zoom = table.Column<double>(type: "double", nullable: true),
                    IOControl = table.Column<int>(type: "int", nullable: true),
                    VisionFile = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Inactive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Remarks = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MissionHistoryInfos", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "WarningInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Type = table.Column<int>(type: "int", nullable: false),
                    TerminalX = table.Column<double>(type: "double", nullable: false),
                    TerminalY = table.Column<double>(type: "double", nullable: false),
                    TerminalA = table.Column<double>(type: "double", nullable: false),
                    Terminal = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Details = table.Column<int>(type: "int", nullable: true),
                    Time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    VisionFile = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Inactive = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Remarks = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WarningInfos", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.InsertData(
                table: "MissionHistoryInfos",
                columns: new[] { "Id", "ArmCode", "CreateTime", "DetectionResult", "EndTime", "Equipment", "IOControl", "Inactive", "Name", "Remarks", "ResultValue", "StartTime", "Terminal", "Type", "VisionFile", "VisionMissionId", "Zoom" },
                values: new object[] { 1, null, new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), null, new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), null, null, false, "Demo任务", null, null, new DateTime(2022, 8, 22, 10, 57, 7, 389, DateTimeKind.Local).AddTicks(3860), null, 2, null, 0, null });

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860) });

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860) });

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 4,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860) });

            migrationBuilder.InsertData(
                table: "WarningInfos",
                columns: new[] { "Id", "CreateTime", "Details", "Inactive", "Remarks", "Terminal", "TerminalA", "TerminalX", "TerminalY", "Time", "Type", "VisionFile" },
                values: new object[] { 1, new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), null, false, null, null, 10.0, 11.0, 12.0, new DateTime(2022, 8, 22, 10, 58, 7, 389, DateTimeKind.Local).AddTicks(3860), 3, null });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MissionHistoryInfos");

            migrationBuilder.DropTable(
                name: "WarningInfos");

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456), new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456) });

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456), new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456) });

            migrationBuilder.UpdateData(
                table: "TemperatureInfos",
                keyColumn: "Id",
                keyValue: 4,
                columns: new[] { "CreateTime", "TempTime" },
                values: new object[] { new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456), new DateTime(2022, 8, 17, 16, 7, 4, 644, DateTimeKind.Local).AddTicks(456) });
        }
    }
}
